<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <!-- 1. 先准备一个容器 -->
    <div id="app">
        <ul>
            <li v-for="(item,index) in list" :key="item.id">{{item.name}}</li>
        </ul>
        <button @click="run">要不要走一走</button>
    </div>
    <!-- 2. 引框架 -->
    <script src="./vue.js"></script>
    <script>
        // 3.初始化vue实例对象
        const vm = new Vue({
            el: "#app",
            data: {
                list: [
                    { id: 1, name: '陈呵呵' },
                    { id: 2, name: '王哈哈' },
                    { id: 3, name: '龙嘻嘻' }
                ]
            },
            methods: {
                run() {
                 
                    // for (let i = 0; i < 3; i++) {
                    //     if (i === 2) {
                    //         i = 0
                    //     }
                    //     this.list[i] = this.list[i++]
                    // }

                    const first=this.list.shift()
                    this.list.push(first)
                }
            }
        });
    </script>
</body>

</html>